package com.zh.websocket;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GreetingController {
    @Autowired
    private MyWebsocketHandler websocketHandler;

    @GetMapping("/count")
    public Integer getUsersCount() {
        var count = websocketHandler.getCount();
        return count;
    }

    @GetMapping("/users")
    public List<String> getUsers() {
        List<String> allUsers = websocketHandler.getAllUsers();
        return allUsers;
    }

}